/**
 * request logic
 */
const NET_CODE_SUC = 200;

/**
 * 判断服务请求是否成功
 * @param response
 * @returns {*|boolean}
 */
export function isResponseSuccess (response) {
  return response && response.code && response.code === NET_CODE_SUC;
}
// 询价状态 转换
export const INQUIRY_IN_STATUS_DES = '询价中';
export const INQUIRY_IN_STATUS_CODE = 100;
export const INQUIRY_DOWN_STATUS_DES = '询价完成';
export const INQUIRY_DOWN_STATUS_CODE = 400;
export const INQUIRY_CANCEL_STATUS_DES = '询价取消';
export const INQUIRY_CANCEL_STATUS_CODE = 500;
export const INQUIRY_PENDING_APPROVAL_STATUS_DES = '订货待审批';
export const INQUIRY_PENDING_APPROVAL_STATUS_CODE = 200;
export const INQUIRY_GENERATE_ORDER_STATUS_DES = '待生成订单';
export const INQUIRY_GENERATE_ORDER_STATUS_CODE = 300;
// 定标查询 ----客户询价 列表字段
export const INQUERY_COLUMNS = [
  {
    prop: 'billType',
    label: '询价类型',
    width: 140,
    formatter: (row, columns, cellValue) => {
      return cellValue === 1 ? '客户询价' : '订货询价';
    },
  },
  {
    prop: 'sourceBillNo',
    label: '采购询价单号',
    width: 140
  },
  {
    prop: 'inquiryDate',
    label: '询价日期',
    width: 140
  },
  {
    prop: 'bidingDate',
    label: '定标日期',
  },
  {
    prop: 'purchaser',
    label: '采购询价部门',
    width: 140
  },
  {
    prop: 'purchaseInquirerName',
    label: '采购询价人',
    width: 100
  },
  {
    prop: 'supplierName',
    label: '供应商名称',
    width: 100
  },
  {
    prop: 'supplierCode',
    label: '供应商代码',
    width: 100
  },
  {
    prop: 'freightPayerName',
    label: '运费承担方',
  },
  {
    prop: 'freightPrice',
    label: '运费',
  },
  {
    prop: 'invoiceType',
    label: '发票类型',
    formatter: (row, columns, cellValue) => {
      if (cellValue == 101) {
        return '普通发票'
      } else if (cellValue == 102) {
        return '增值税专用发票'
      } else if (cellValue == 103) {
        return '无税票'
      }
    },
  },
  {
    prop: 'taxRateVal',
    label: '税率',
  },
  {
    prop: 'bidderOrNot',
    label: '是否中标',
    formatter: (row, columns, cellValue) => {
      return cellValue === 1 ? '是' : '否';
    },
  },
  {
    prop: 'recommendSupplier',
    label: '是否推荐供应商',
    width: 120,
    formatter: (row, columns, cellValue) => {
      return cellValue === 1 ? '是' : '否';
    },
  },
  {
    prop: 'orderReason',
    label: '未使用推荐供应商原因',
    width: 100,
  },
  {
    prop: 'signContractStr',
    label: '是否签合同',
    width: 100,
  },
  {
    prop: 'noSignContractReason',
    label: '未签合同原因',
    width: 100,
  },
  {
    prop: 'pushOrNot',
    label: '是否下推采购订单',
    width: 120,
    formatter: (row, columns, cellValue) => {
      return cellValue === 1 ? '是' : '否';
    },
  },
  {
    prop: 'purchaseOrderCode',
    label: '采购订单号',
  },
  {
    prop: 'stockAttrStr',
    label: '存量属性',
  },
  {
    prop: 'factoryCode',
    label: '厂家商品代码',
    width: '100'
  },
  {
    prop: 'factoryName',
    label: '厂家商品名称',
    width: '100'
  },
  {
    prop: 'skuCode',
    label: '商品代码',
  },
  {
    prop: 'skuName',
    label: '商品名称',
  },
  {
    prop: 'categoryCode',
    label: '分类代码',
  },
  {
    prop: 'categoryName',
    label: '分类名称',
  },
  {
    prop: 'skuSpecifications',
    label: '规格',
  },
  {
    prop: 'skuUnit',
    label: '主计量单位',
  },
  {
    prop: 'assistSkuUnit',
    label: '辅计量单位',
  },
  {
    prop: 'skuNum',
    label: '报价主数量',
  },
  {
    prop: 'assistSkuNum',
    label: '报价辅数量',
  },
  {
    prop: 'numOfBids',
    label: '中标主数量',
  },
  {
    prop: 'isProceduresStr',
    label: '是否走手续',
    width: 100
  },
  {
    prop: 'isServiceProviderStr',
    label: '是否服务商',
    width: 100
  },
  {
    prop: 'serviceProviderName',
    label: '指定渠道名称',
    width: 120
  },
  {
    prop: 'unitPrice',
    label: '主进价',
  },
  {
    prop: 'assistUnitPrice',
    label: '辅进价',
  },
  {
    prop: 'deliveryDate',
    label: '交货期',
  },
  {
    prop: 'workableArrivalTime',
    label: '落实到货时间',
  },
  {
    prop: 'remark',
    label: '采购备注',
  },
  {
    prop: 'costPrice',
    label: '成本价',
  },
  {
    prop: 'totalPrice',
    label: '小计',
  },
]
export const SET_SOURCINGSUPP_LIST = [
  {
    prop: 'skuName',
    label: '商品名称',
  },
  {
    prop: 'skuSpecifications',
    label: '规格型号',
  },
  {
    prop: 'skuUnit',
    label: '计量单位',
  },
  {
    prop: 'skuNum',
    label: '数量',
  },
  {
    prop: 'unitPrice',
    label: '单价',
  },
  {
    prop: 'skuPrice',
    label: '金额',
  }
]
export const PUSH_DOWN_PAGELIST = [
  {
    prop: 'skuCode',
    label: '商品代码',
  },
  {
    prop: 'skuName',
    label: '商品名称',
  },
  {
    prop: 'skuSpecifications',
    label: '规格型号',
  },
  {
    prop: 'skuUnit',
    label: '计量单位',
  },
  {
    prop: 'assistSkuUnit',
    label: '辅计量单位',
  },
  {
    prop: 'unitPrice',
    label: '进价',
  },
  {
    prop: 'assistUnitPrice',
    label: '辅进价',
  },
  {
    prop: 'skuNum',
    label: '数量',
  },
  {
    prop: 'assistSkuNum',
    label: '辅数量',
  },
  {
    prop: 'skuPrice',
    label: '金额',
  }
]
